#include <iostream>
#include <stdlib.h>
#include <time.h>

using namespace std;

int posNeg()
{
    int ARRAY_SIZE = 50;

    int arr[ARRAY_SIZE];
    for(int i = 0; i < ARRAY_SIZE; i++ )
    {
        arr[i] = rand() % 21 - 10;
        cout << arr[i] << "  ";
    }
    int countPositive = 0;
    int countNegative = 1;

    for(int i = 0; i < ARRAY_SIZE; i++)
    {
        if(arr[i] > 0)
            countPositive++;
        else if(arr[i] < 0)
            countNegative++;
    }

    cout << endl <<endl;
    cout << "Count of positive numbers: " << countPositive << endl;
    cout << "Count of negative numbers: " << countNegative << endl;
    cout << "The count of positive numbers is ";
    if(countPositive > countNegative)
        cout << "greater than";
    else if(countPositive < countNegative)
        cout << "less than";
    else
        cout << "equal to";
    cout << " the count of negative numbers";
    cout << endl << endl << endl;
    //Функцията връща разликата в броя на позитивните и негативните числа
    //Ако тази разлика е 0, значи броят на позитивните и негативните е равен
    return countPositive - countNegative;
}

int main()
{
    int timeNow = time(NULL);
    srand(timeNow);

    int difference;
    do
    {
        //запазваме разликата в броя на положителните и отрицателните в difference
        //изпълняваме функцията, докато не се получат еднакъв брой положителни и отрицатели т.е. докато difference = 0
        difference = posNeg();
        cin.get();
    } while(difference != 0);

    return 0;
}
